package com.avfh.netcard.config;

import com.avfh.netcard.interceptor.WxIntercepter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

//@Configuration
public class InterceptorConfig extends WebMvcConfigurerAdapter {

    @Bean
    public HandlerInterceptor wxInterceptor() {
        return new WxIntercepter();
    }


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(wxInterceptor())
                .addPathPatterns("/api/**")
                .excludePathPatterns("/api/check/**");
        super.addInterceptors(registry);
    }

}